home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 4 / QRZ Ham Radio Callsign Database - Volume 4.iso / files / tcpip / amiga / asrc29p.lha / files.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-29  |  3.5 KB  |  96 lines

  1. /* System-dependent definitions of various files, spool directories, etc */
  2. #include "global.h"
  3. #include "files.h"
  4.  
  5. char *Startup        = "NOS-Startup";
  6. char *NOSDial        = "NOS-Dial";
  7. char *Config        = "Config.NOS";            /* Device configuration list */
  8. char *Hostfile        = "NOS.rc";
  9. char *Userfile        = "FTPusers";
  10. char *LogsDir        = "Logs";
  11. char *Mailspool        = "Spool/Mail";
  12. char *Mailqdir        = "Spool/Mqueue";
  13. char *Mailqueue        = "Spool/Mqueue/#?.WRK";
  14. char *Routeqdir        = "Spool/Rqueue";        /* queue for router */
  15. char *Alias        = "Alias";            /* the alias file */
  16. char *Dfile        = "Domain.TXT";            /* Domain cache */
  17. char *Fdir        = "Finger";            /* Finger info directory */
  18. char *Arealist        = "Spool/Areas";        /* List of message areas */
  19. char *Helpdir        = "Spool/Help";            /* help file directory */
  20. char *Rewritefile    = "Spool/Rewrite";         /* Address rewrite file */
  21. char *Signature        = "Spool/Signature";        /* Mail signature file directory */
  22. char *Pop2users        = "POP2users";            /* POP2 user and password file */
  23. char *Pop3users        = "POP3users";            /* POP3 user and password file */
  24. char *Newsdir        = "Spool/News";            /* News messages and NNTP data */
  25. char *Newsqueue        = "Spool/News/#?.WRK";
  26. char *Forwardfile    = "Spool/Forward.BBS";        /* Mail forwarding file */
  27. char *Historyfile    = "Spool/History";        /* Message ID history file */
  28. char *Chatnode        = "Chatnode.CFG";        /* Chatnode */
  29. char *SignOn        = "Spool/Signon";        /* SignOn files Mbox, FTP, TTY. */
  30. char *Digger        = "Digger";            /* where Digger topics are held */
  31. char *DiggerC        = "Digger/Cache";        /* where Digger topics are held */
  32. char *Spoolqdir        = "Spool";
  33.  
  34. #define    SEPARATOR    ":"
  35.  
  36. static char *strcatdup __ARGS((char *a,char *b,char *c));
  37.  
  38. /* Establish a root directory other than the default. Can only be called
  39.  * once, at startup time
  40.  */
  41. void initroot(root)
  42. char *root;
  43. {
  44.     Startup = strcatdup(root,SEPARATOR,Startup);
  45.     NOSDial = strcatdup(root,SEPARATOR,NOSDial);
  46.     Userfile = strcatdup(root,SEPARATOR,Userfile);
  47.     Hostfile = strcatdup(root,SEPARATOR,Hostfile);
  48.     LogsDir = strcatdup(root,SEPARATOR,LogsDir);
  49.     Mailspool = strcatdup(root,SEPARATOR,Mailspool);
  50.     Mailqdir = strcatdup(root,SEPARATOR,Mailqdir);
  51.     Mailqueue = strcatdup(root,SEPARATOR,Mailqueue);
  52.     Routeqdir = strcatdup(root,SEPARATOR,Routeqdir);
  53.     Alias = strcatdup(root,SEPARATOR,Alias);
  54.     Dfile = strcatdup(root,SEPARATOR,Dfile);
  55.     Fdir = strcatdup(root,SEPARATOR,Fdir);
  56.     Arealist = strcatdup(root,SEPARATOR,Arealist);
  57.     Helpdir = strcatdup(root,SEPARATOR,Helpdir);
  58.     Rewritefile = strcatdup(root,SEPARATOR,Rewritefile);
  59.     Signature = strcatdup(root,SEPARATOR,Signature);
  60.     Pop2users = strcatdup(root,SEPARATOR,Pop2users);
  61.     Pop3users = strcatdup(root,SEPARATOR,Pop3users);
  62.     Newsdir = strcatdup(root,SEPARATOR,Newsdir);
  63.     Newsqueue = strcatdup(root,SEPARATOR,Newsqueue);
  64.     Forwardfile = strcatdup(root,SEPARATOR,Forwardfile);
  65.     Historyfile = strcatdup(root,SEPARATOR,Historyfile);
  66.     Chatnode = strcatdup(root,SEPARATOR,Chatnode);
  67.     SignOn = strcatdup(root,SEPARATOR,SignOn);
  68.     Digger = strcatdup(root,SEPARATOR,Digger);
  69.     DiggerC = strcatdup(root,SEPARATOR,DiggerC);
  70.     Spoolqdir = strcatdup(root,SEPARATOR,Spoolqdir);
  71. }
  72.  
  73. /* Concatenate three strings into a malloc'ed output buffer */
  74. static char *strcatdup(a,b,c)
  75. char *a,*b,*c;
  76. {
  77.     char *out,*p1,*p2;
  78.  
  79.     out = mallocw(strlen(a) + strlen(b) + strlen(c) + 1);
  80.     strcpy(out,a);
  81.     strcat(out,b);
  82.     strcat(out,c);
  83.     if(*b != '\0'){
  84.         /* Remove any repeated occurrences of the separator char */
  85.         p1 = p2 = out;
  86.         while(*p2 != '\0'){
  87.             *p1++ = *p2++;
  88.             while(p2[0] == p2[-1] && p2[0] == b[0])
  89.                 p2++;
  90.         }
  91.         *p1 = '\0';
  92.     }
  93.     return out;
  94. }
  95.  
  96.